<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<title> 统计 </title>
<?php include VIEWS.'admin/style.html'?>
<script type="text/javascript" src="/scripts/swfobject.js"></script>
<script type="text/javascript">
    swfobject.embedSWF("/views/admin/open-flash-chart.swf", "statchart", "80%", "400", "9.0.0", "expressInstall.swf", {"data-file":"stat.php?data=<?php echo $_GET['show']?>"} );
</script>
</head>

<body>

<?php include VIEWS.'admin/head.html'?>

<ul id="submenu">
	<li><a href='/admin/stat.php'>商品销售排行</a></li>
    <li><a href='/admin/stat.php?show=MonthIndentCount'<?php if($_GET['show']=='MonthIndentCount') echo ' class="current"'?>>订单数统计</a></li>
	<li><a href='/admin/stat.php?show=MonthIncome'<?php if($_GET['show']=='MonthIncome') echo ' class="current"'?>>营业额统计</a></li>
</ul>

<?php
if ($_GET['show'] == 'MonthIndentCount') {
    $title1 = '全部订单';
    $title2 = '有效订单';
}

if ($_GET['show'] == 'MonthIncome') {
    $title1 = '营业金额';
    $title2 = '毛利';
}
?>

<div id="body">
    
    <div id="statchart"></div>

    <div id="data" style="margin-top:40px;">
    <table class="reportV2" cellpadding="5" width="90%" cellspacing="0" style="margin:auto">
        <tr class="columntitle"><td>日期</td><td><?php echo $title1?></td><td><?php echo $title2?></td></tr>
        <?php if($data1) foreach($data1 as $k=>$v):?>
        <tr>
            <td nowrap="nowrap"><b><?php echo $v['dt']?></b></td>
            <td width="50%"><?php echo $data2[$k]['ct'];$tmp=@number_format(($data2[$k]['ct']-$pre2)/$pre2, 4)*100?> &nbsp; <small style="color:<?php echo $tmp>0 ? 'red' : 'green'?>">(<?php echo $tmp?>%)</small></td>
            <td width="50%"><?php echo $v['ct'];$tmp=@number_format(($v['ct']-$pre)/$pre, 4)*100?> &nbsp; <small style="color:<?php echo $tmp>0 ? 'red' : 'green'?>">(<?php echo $tmp?>%)</small></td>
        </tr>
        <?php 
        $pre = $v['ct'];
        $pre2 = $data2[$k]['ct'];
        endforeach?>
    </table>
        
    </div>

    <?php include VIEWS.'admin/runtime.html'?>

</div>

<script type="text/javascript">
Element.addClassName('am5', 'current');
</script>

</body>
</html>
